#ifndef _DATA_H_
#define _DATA_H_

/**************
*     TEXT
**************/
/*
* TEXT IN EEPROM MEMORY
*/
//// file names
// settings file name
#define TXT_SETFILE 0
// control config file name
#define TXT_CNFFILE 1
// records file name
#define TXT_RECFILE 2

//// LCD Text
// SD error text
#define TXT_SDERR   3
// File error text
#define TXT_FILEERR 4
// DHCP error
#define TXT_DHCPERR 5
// Connection error
#define TXT_CONNERR 6
// Time setting
#define TXT_SETTIME 7
// Date setting
#define TXT_SETDATE 8
// Connecting info
#define TXT_INFCONN 9
// Connected text
#define TXT_CONNOK 10
// Receiving data
#define TXT_RECVDATA 11
// Sending data
#define TXT_SENDDATA 12
// Temperature
#define TXT_TEMP 13
// Humidity
#define TXT_HUM 14
// Soil moisture
#define TXT_SOIL 15
// Watering
#define TXT_WAT 16
// Ventilation
#define TXT_VENT 17
// On, Off
#define TXT_ON 18
#define TXT_OFF 19
// Connection state info
#define TXT_CONN 20

//// HTTP REQUEST
// HTTP Get request head prefix
#define REQ_HEAD1 21
// action check
#define REQ_CHECK 22
// action send data
#define REQ_SEND 23
// action data received
#define REQ_RECV 24
// key=
#define REQ_KEY 25
// name=
#define REQ_NAME 26
// HTTP head postfix
#define REQ_HEAD2 27
// Host: 
#define REQ_HOST 28
// Connection:
#define REQ_CONN1 29
// closed
#define REQ_CONN2 30

// create grad character
byte grad[8] = {
  B00110,
  B01001,
  B01001,
  B00110,
  B00000,
  B00000,
  B00000,
  B00000,
};


/**************
*     PINOUT
***************/
// LCD pins
#define RS 8
#define EN 9
#define D4 3
#define D5 5
#define D6 6
#define D7 7

// Keypad pin
#define KEYPAD_PIN A0

// DHT sensor pin
#define DHT_PIN    A1

// Soil Moisture sensor pin
#define SM_PIN     A2

// Ventilation relais pin
#define VENT_PIN   1

// Watering relais pin
#define WAT_PIN    2

/*****************
*    LCD SIZE
******************/
#define ROWS 2
#define COLS 16

/****************
*     KEYS
*****************/
#define KEY_RIGHT  0
#define KEY_UP     1
#define KEY_DOWN   4
#define KEY_LEFT   7
#define KEY_SELECT 10
#define KEY_NONE   15

/*****************
*    LCD PAGES
******************/
#define PAGES    5

#define PAGE_DT  0
#define PAGE_TH  1
#define PAGE_SM  2
#define PAGE_VW  3
#define PAGE_NS  4


/*********************
*  TRACE ACTION DATA
**********************/
#define TRIGG_AUTO  '1'
#define TRIGG_MAN   '0'
#define ACT_VENT    '0'
#define ACT_WAT     '1'
#define STATE_ON    '1'
#define STATE_OFF   '0'

/*********************
*  NET MODES
**********************/
#define NET_OFF  0
#define NET_DHCP 1
#define NET_IP   2
#define NET_DNS  3
#define NET_GW   4
#define NET_MASK 5

/*********************
* HTTP REQUEST ACTION
**********************/
#define HTTP_CHECK 0
#define HTTP_SEND  1
#define HTTP_RECV  2

/**********************
* HTTP RESPONSE TAGS
***********************/
#define TAG_BEGIN '<'
#define TAG_TIME  't'
#define TAG_AUTH  'a'
#define TAG_SEND  's'
#define TAG_RECV  'r'
#define TAG_OK    'o'
#define TAG_END   '/'

/**********************
* HTTP RESPONSE DATA
***********************/
#define AUTH_OK   1

#endif

